package com.fireXXX.job.analysis.data.api.job;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;

@Entity
@Table
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
public class Job {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @CreatedDate
    @Column(name = "create_datetime", nullable = false, updatable = false)
    protected LocalDateTime createDateTime;

    @LastModifiedDate
    @Column(name = "update_datetime", nullable = false)
    protected LocalDateTime updateDateTime;

    @Column
    private String name;

    @Column
    private String area;

    @Column(name = "publish_time")
    private String publishTime;

    @Column
    private String education;

    // 工作年限
    @Column
    private String experiences;

    @Column
    @Convert(converter = ListToStringConverter.class)
    private List<String> tags;

    @Column(name = "detail_url")
    private String detailUrl;

    @Column
    private String salary;

    @Column(name = "recruiters_name")
    private String recruitersName;

    @Column(name = "recruiters_job")
    private String recruitersJob;

    @Enumerated(EnumType.STRING)
    private SourceTypeEnum source;

    @Column(name = "company_detail")
    private String companyDetail;

}
